import { Navigate, Outlet } from 'react-router-dom';

import AuthGuard from '../components/auth-guard';
import { getRoutesFromModules } from '../utils';
const menuModuleRoutes = getRoutesFromModules();

const { VITE_APP_HOMEPAGE: HOMEPAGE } = import.meta.env;
/**
 * dynamic routes
 */
export const AuthRoutes = {
  path: '/',
  element: (
    <AuthGuard>
      <Outlet />
    </AuthGuard>
  ),
  children: [{ index: true, element: <Navigate to={HOMEPAGE} replace /> }, ...menuModuleRoutes],
};
